#include "DepthTechnique.h"


DepthTechnique::DepthTechnique(void)
{
}


DepthTechnique::~DepthTechnique(void)
{
}

bool DepthTechnique::Init()
{
	if(!Technique::Init())
	{
		std::cout << "DepthTechnique: failed at Init()" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	if(!AddShader(GL_VERTEX_SHADER, "Shader/Shadow/DepthRTT.vertexshader"))
	{
		std::cout << "DepthTechnique: AddShader(vertex) failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}
	
	if(!AddShader(GL_FRAGMENT_SHADER, "Shader/Shadow/DepthRTT.fragmentshader"))
	{
		std::cout << "DepthTechnique: AddShader(fragment) failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	if(!Finalize())
	{
		std::cout << "DepthTechnique: Finalize failed" << std::endl;
		if (std::cin.get() == '\n')		
			return false;
	}

	m_DepthMatrixID = GetUniformLocation("depthMVP");

	return true;
}

void DepthTechnique::setDepthMatrixID(const glm::mat4& depthMVP)
{
	glUniformMatrix4fv(m_DepthMatrixID, 1, GL_FALSE, &depthMVP[0][0]);
}
